package cn.gson.springboot.model.service;

import cn.gson.springboot.model.dao.PlanreceivableDao;
import cn.gson.springboot.model.mapper.PlanReceivableMapper;
import cn.gson.springboot.model.pojos.Planreceivable;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

import java.util.List;
@Service
public class PlanReceivableService {
    @Autowired
    PlanReceivableMapper planReceivableMapper;
    @Autowired
    PlanreceivableDao planreceivableDao;

   /* public List<Planreceivable> selectPlanReceivable(Integer type){
            return planReceivableMapper.selectPlanReceivable(type);
    }*/

   /* public List<Planreceivable> selectPlanReceivableByDate(String content){
        return planReceivableMapper.selectPlanReceivableByDate(content);
    }*/

    public Planreceivable selectPlanReceivableById(Integer backId) {
        return  planReceivableMapper.selectPlanReceivableById(backId);
    }

    @Transactional(transactionManager = "transactionManager")
    public void savePlanreceivable(Planreceivable planreceivable){
        planreceivableDao.save(planreceivable);
    }

    @Transactional(transactionManager = "transactionManager")
    public void deletePlanreceivable(Integer planreceivableId){
        planreceivableDao.deleteById(planreceivableId);
    }

    public List<Planreceivable> selectBackByConId(Integer conId) {
        return planReceivableMapper.selectBackByConId(conId);
    }

    public List<Planreceivable> selectPlanReceivable(int deptId, int empId, Integer filter, Integer vague, String content) {
        return planReceivableMapper.selectPlanReceivable(deptId,empId,filter,vague,content);
    }

    public List<Planreceivable> selectContractPlanPastFutureThirty() {
        return planReceivableMapper.selectContractPlanPastFutureThirty();
    }

    public List<Planreceivable> selectContractPlanMonth() {
        return planReceivableMapper.selectContractPlanMonth();
    }
}
